package com.study.business.article.controller;

import com.study.business.article.domain.Article;
import com.study.business.article.service.ArticleService;
import com.study.business.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("core")
/**
 *
 * @author zhang
 * @version 1.0
 * @date 2019年3月19日
 */
public class ArticleController {

    @Autowired
    private ArticleService articleService;

    @PostMapping(value = "v1/article")
    public ResponseUtil writeArticle(@RequestBody Article article) {
        return articleService.add(article);
    }

    @GetMapping(value = "v1/articles")
    public ResponseUtil getInterviews() {
        return articleService.findAll();
    }
}
